package ten.test_10_10;

import java.util.Scanner;

import static java.lang.Character.toUpperCase;

public class TestMain {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        for (int i = 0; i < n; i++) {
            String str = sc.nextLine();
            for (int j = 0; j < str.length(); j++) {
                if(j == 0) {
                    System.out.print(toUpperCase(str.charAt(j)));
                } else if(str.charAt(j) == '_') {
                    j++;
                    System.out.print(toUpperCase(str.charAt(j)));
                } else {
                    System.out.print(str.charAt(j));
                }
            }
            System.out.println();
        }
    }
}
